<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.beaut.project.util.FlowUtility" %>
<%@ page import="com.beaut.project.util.StaticData" %>
<%@ include file="/public/header.jsp"%>
<%
	Map<String, Object> sessionMap = (Map<String, Object>) session.getAttribute("LOGIN_USER");
	String person_id = String.valueOf(sessionMap.get("id"));
	String person = String.valueOf(sessionMap.get("truename"));
%>
<html>
	<head>
		<title>财务班主垫款完成事项</title>
			<link href="<%=contextPath%>/public/css/smart_wizard_vertical.css" rel="stylesheet"	type="text/css">
		<script type="text/javascript" src="<%=contextPath%>/public/js/jquery.smartWizard.js"></script>
		<link  rel="stylesheet"  href  ="<%=contextPath%>/public/swfupload/css/swfupload.css">
	
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
			.tdg{
			padding-top:10px;
			padding-bottom:5px;
			font-size: 12px;
			background-color: #c0ebd7;
			width:20%;
		}
		.tdb{
			padding:5px;
			width:30%;
		}
		</style>
		  <script  type="text/javascript"  src="<%=contextPath%>/core/js/datastructs.js"  ></script>
			<script  type="text/javascript"  src="<%=contextPath%>/core/js/sys.js"  ></script>
			<script  type="text/javascript"  src="<%=contextPath%>/core/js/prototype.js"  ></script>
		<script type="text/javascript" src="<%=contextPath%>/public/swfupload/js/attachMenu.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/public/swfupload/js/Menu.js"></script>
		<script  type="text/javascript"  src="<%=contextPath%>/public/swfupload/js/swfupload.js"  ></script>
		<script  type="text/javascript"  src="<%=contextPath%>/public/swfupload/js/fileprogress.js"  ></script>
		<script  type="text/javascript"  src="<%=contextPath%>/public/swfupload/js/handlers.js"  ></script>
		<script  type="text/javascript"  src="<%=contextPath%>/public/swfupload/js/swfupload.queue.js"  ></script>
	<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery("#searchValue").keypress(function(e) { 
	    	// 回车键事件 
	     	if(e.which == 13) { 
	     		 doSearch();
	       	} 
		});
		jQuery("#searchValue1").keypress(function(e) { 
	    	// 回车键事件 
	     	if(e.which == 13) { 
	     		 doSearch1();
	       	} 
	   	}); 
		jQuery("#dd").hide();
		jQuery("#dept_id").combotree({
			url:'<%=contextPath %>/springMVC/group/listDepartment',
			method:'POST',
			animate:true,
			lines:true,
			onChange:function(){
				doSearch();
			}
		});
		var typeArr=new Array("内部班组","外部分包商");
		jQuery('#gd_worker_id').combogrid({
			idField:"id",
			textField:"worker_company",
			title:'分包商资料',
			panelWidth:550,
			panelHeight:400,
			rownumbers:true,
			url:'<%=contextPath%>/springMVC/crm/listPageWorker',
			loadMsg:'正在加载数据，请稍后......',
			fitColumns:true,
			frozenColumns:[[
			    {title:'主键',field:'id',hidden:true}
			]],
			columns:[[
				{title:'分包商类别',field:'type_id',width:200,align:'center',formatter:function(value,rowData,rowIndex){
					return typeArr[rowData.type_id];
				}},
				{title:'公司名称',field:'worker_company',width:200,align:'center'},
				{title:'负责人',field:'worker_person',width:200,align:'center'},
				{title:'联系方式',field:'contact',width:200,align:'center'}
			]],
			pageSize:10,
			pageList : [10,50,100],  
			pagination:true,
			toolbar:'#tb1',
			onChange:function(){
				doSearch();
			}
		});
		jQuery("#table").datagrid({
			title:"班主垫款完成事项",
			iconCls:'icon-zc',
			loadMsg:'正在加载数据，请稍后......',
			url:'<%=contextPath %>/springMVC/gd/listFinanceGdAdvances?zc_status=2',
			rownumbers:true,
			fitColumns:true,
			nowrap:false,
			idField:'id',
			frozenColumns:[[
			      {title:'主键',field:'id',hidden:true}
			]],
			columns:[[
				{title:'所属部门',field:'dept_name',width:100,align:'center'},
				{title:'工单编号',field:'gd_code',width:100,align:'center'},
				{title:'班组',field:'fb_advances',width:100,align:'center'},
				{title:'日期',field:'operation_date',width:100,align:'center',sort:true},
				{title:'放款日期',field:'actual_operation_date',width:100,align:'center',sort:true},
				{title:'金额',field:'money',width:100,align:'center'},
				{title:'利率',field:'rate',width:100,align:'center'},
				{title:'经办人',field:'person_name',width:100,align:'center'},
				{title:'摘要',field:'remark',width:200,align:'center'},
				{title:'查看凭证',field:'edit',width:100,align:'center',formatter:function(value,rowData,rowIndex){
                	return "<input type='button' style='border:0px #ff0000 solid;width:16px;height:16px;cursor:pointer;' class='icon-details' title='查看' onclick=\"javascript:showLoanOrAdvances('"+rowData.id+"');\"/>&nbsp;&nbsp;";

				}}
			]],
			pageSize:10,
			pageList : [10,50,100],  
			pagination:true,
			onLoadSuccess:function(rtJson){
				//预留状态判断，以后工单完工之后不允许修改。
				//if(""){
					//$("#add").hide();
					//$("#jdwc").hide();
				//}
				if(rtJson.rtState== '1')
				{
					$.messager.alert('提示',rtJson.rtMsrg);
				}
			}
		});
		
		
	});
	function showLoanOrAdvances(id){
		var url= "<%=contextPath%>/springViews/gd/viewAdvances.jsp?advances_id="+id;
		openDialogResize(url,1000,800);
	}
	
	function doSearch() {
		var start_time=jQuery('#start_time').datebox('getValue');  
		var end_time=jQuery('#end_time').datebox('getValue'); 
		var searchValue=jQuery('#searchValue').val();
		var dept_id = jQuery("#dept_id").combotree('getValue');
		var gd_worker_id = jQuery("#gd_worker_id").combotree('getValue');
		jQuery('#table').datagrid('load', {
			start_time:start_time,
			end_time:end_time,
			searchValue:searchValue,
			dept_id:dept_id,
			gd_worker_id:gd_worker_id
		});
	}
	function ExcelOut(){
		var start_time=jQuery('#start_time').datebox('getValue');  
		var end_time=jQuery('#end_time').datebox('getValue'); 
		var searchValue=jQuery('#searchValue').val();
		var dept_id = jQuery("#dept_id").combotree('getValue');
		var gd_worker_id = jQuery("#gd_worker_id").combotree('getValue');
		var param = "start_time="+start_time+"&end_time="+end_time+"&searchValue="+encodeURIComponent(searchValue)+"&dept_id="+dept_id+"&gd_worker_id="+gd_worker_id;
		window.open('<%=contextPath %>/springMVC/excel/financeGdAdvancesExcel?'+param);
	}
	function doSearch1() {
		var searchValue = jQuery('#searchValue1').val();
		var type_id = jQuery('#type_id').val();
		jQuery('#gd_worker_id').combogrid("grid").datagrid('load', {
			searchValue : searchValue,
			type_id : type_id
		});
	}
</script>
</head>
<body>
	
				
						<div id="table"  data-options="toolbar:'#tb',fit:true"></div>  
							<div id="tb" style="padding:3px;height:auto">
					<div align="right">
								开始时间：<input id="start_time" name="start_time" class="easyui-datebox" style="width:100px" />&nbsp;&nbsp;&nbsp;结束时间：<input id="end_time" name="end_time" class="easyui-datebox" style="width:100px"/>
								所属部门：<input  id="dept_id" name="dept_id" class="easyui-combotree" style="width:140px">&nbsp;&nbsp; 
								班组：<input type="text" id="gd_worker_id" name="gd_worker_id"   style="width:100px">
								工单编号/名称：<input id="searchValue" name="searchValue" style="width:120px" title="工单编号/名称"  placeholder="工单编号/名称 "/>&nbsp;&nbsp; 
								<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch();"></a>
						<input type='button'  style='border:0px #ff0000 solid;width:16px;height:16px;cursor:pointer;' class='icon-excel' title='导出Excel' onclick='ExcelOut()'/>
			
			<div id="tb1" style="padding:3px;height:auto">
			<div align="right">
				分类：<select id="type_id" class="" name="type_id"  onchange="doSearch1()">   
					     <option value="" selected></option> 
					    <option value="0">内部班组</option>   
					    <option value="1">外部分包商</option>   
					</select>  
				查询条件：<input id="searchValue1" name="searchValue1" style="width:150px" title="分包商名称或负责人"/>&nbsp;&nbsp;
				<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch1();"></a>
			</div>
		</div>
			<div id="dd"  style="margin-top:-200px;">
				<div style="text-align:center;">
					<input type="text" id="bank_id" name="bank_id"  data-options="required:true">
				</div>
			</div>
				<input type="hidden" id="bank" name="bank" />
				<input type="hidden" id="finance_company_id" name="finance_company_id" />
				<input type="hidden" id="account" name="account" />	
				<input type="hidden" id="money" name="money" value="0" />	
	</body>
</html>